﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace serie02_4_geo_obj_mousehandler
{
    class Triangle : GeometricObject
    {
        protected override void specialPaint(System.Windows.Forms.PaintEventArgs e)
        {
            int border = (int)((this.Width - innerRectangle.Width) / 2);

            // Dreieck
            int xLeft = border;
            int xRight = this.Width - border - 1;
            int xMiddle = ((xRight - xLeft) / 2) + border;
            int yTop = border;
            int yBottom = this.Height - border -1;

            System.Drawing.Point[] points = new System.Drawing.Point[4];

            points[0] = new System.Drawing.Point();
            points[0].X = xLeft;
            points[0].Y = yBottom;

            points[1] = new System.Drawing.Point();
            points[1].X = xMiddle;
            points[1].Y = yTop;

            points[2] = new System.Drawing.Point();
            points[2].X = xRight;
            points[2].Y = yBottom;

            points[3] = new System.Drawing.Point();
            points[3].X = xLeft;
            points[3].Y = yBottom;

            e.Graphics.DrawPolygon(objectPen, points);
        }
    }
}
